package com.luo.bbs.front.webapi.controller;


import com.example.bbs.front.service.IAdviceService;
import com.example.bbs.front.service.IForAdminService;
import com.luo.common.restful.JsonResult;
import com.luo.pojo.advice.dto.AdviceDTO;
import com.luo.pojo.question.vo.QuestionVO;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 *  前端控制器
 * </p>
 *
 * @author bin.cn
 * @since 2023-01-19
 */
@RestController
@RequestMapping("/advice")
public class AdviceController {
    @Autowired
    private IAdviceService adviceService;


    /**
     * 发表意见
     * @param adviceDTO
     * @return
     */
    @PostMapping("/write")
    public JsonResult write(AdviceDTO adviceDTO){
        adviceService.write(adviceDTO);
        return JsonResult.ok();
    }

    /**
     * 查询用户意见数
     */
    @GetMapping("/count")
    public JsonResult getCount(){
        Integer integer = adviceService.countByUser();
        return JsonResult.ok(integer);
    }


}
